package juhouse.glb.area.dao;

import hzjbbis.framework.cache.DBUtil;
import hzjbbis.framework.util.dao.JbbisDao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

public class RoadDao extends JbbisDao{

	public String[][] getProvinceList()
	{
		String[][] template = null;
		return template;
	}
	public String[][] getCityList(String provinceId)
	{
        PreparedStatement ps = null;
        Connection conn = null;
        ResultSet rs = null;
        String[][] template = null;
        StringBuffer sqlString = new StringBuffer();
    	sqlString.append("select areaId,area,(select count(*) from STREET where STREET.AreaId like Area.areaId+'%') as STREETCount from Area where AREA.Available=1 and AREAID like ? and NODELEVEL=3 order by dOrder");
        try
        {
        	conn = this.getConnection();
        	ps = conn.prepareStatement(sqlString.toString());
        	ps.setString(1,provinceId+'%');
        	rs = ps.executeQuery();
        	template = DBUtil.getQueryResultStrArray(rs);
        }catch(SQLException e){
        	System.out.print(e.toString());
        }finally{
        	this.close(conn,ps,rs);
        }
        return template;
	}
}
